From: Eli Zaretskii Date: Sat, 24 May 2025 09:56:30 +0000 (+0300) Subject: Fix documentation of use-package's ':hook' keyword X-Git-Tag: archive/raspbian/1%30.2+1-2+rpi1^2~2^2~24^2~71 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/%22bookmarks:/?a=commitdiff_plain;h=36afdd2f6f9f6bbb6bcc95ff2fb1e426c0bcdb3d;p=emacs.git Fix documentation of use-package's ':hook' keyword * doc/misc/use-package.texi (Hooks): Document how to add several functions to the same hook (bug#77609). --- diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi index c14e7b77d23..69dd68d7f3a 100644 --- a/doc/misc/use-package.texi +++ b/doc/misc/use-package.texi @@ -1191,8 +1191,7 @@ keybindings you've set using either the @code{:bind} keyword or the @cindex hooks @findex :hook The @code{:hook} keyword allows adding functions to hooks. It takes -@c FIXME: The actual forms accepted by :hook are different, see below! -one argument of the form @var{hooks}, specifying one or more functions +one argument of the form @var{hooks}, specifying or more functions to add to one or more hooks. For the purposes of @code{:hook}, the name of hook variables should always exclude the @samp{-hook} suffix. It is appended automatically for you, to save some typing. @@ -1265,6 +1264,17 @@ applied, the following examples are all equivalent: @end group @end lisp +To add more than one function to the same hook, add them separately, +like this: + +@lisp +@group +(use-package company + :hook ((prog-mode . company-mode) + (prog-mode . some-other-function))) +@end group +@end lisp + One common mistake when using @code{:hook} is to forget to omit the @samp{-hook} suffix, which, as already explained, is appended automatically. Therefore, the following will not work, as it attempts